<!--
 * @Author: Pure <305737824@qq.com>
 * @CreateTime: 2022-02-22 13:35:20
 * @LastEditors: Pure <305737824@qq.com>
 * @LastEditTime: 2022-02-22 16:39:49
 * @Description:科室二维码
-->
<template>
  <el-skeleton animated :loading="loading" :rows="3">
    <template slot="template" />
    <template>
      <div class="pure">
        <template v-for="(item,index) in list">
          <div :key="index" class="card" style="page-break-after: always;">
            <div class="title">微信扫码报修</div>
            <div class="dept">(信息科)</div>
            <div class="qr-code">
              <img :src="item.imageUrl">
              <div class="dept2">{{ item.deptName }}</div>
            </div>
          </div>

        </template>

      </div>
    </template>
  </el-skeleton>

</template>

<script>
import DepartmentApi from '@/feat/system/department/api';
export default {
  name: 'PropertyQRCode',
  props: {
    deptIds: {
      type: Array,
      default: () => [],
    },
  },
  data() {
    return {
      list: [],
      loading: false,
    };
  },
  created() {
  },
  mounted() {
    this.loading = true;
    this.fetchData();
  },
  methods: {
    // 获取二维码信息
    async fetchData() {
      console.log('deptIds', this.deptIds);
      this.list = await DepartmentApi.qrcode(this.deptIds.join(','));
      this.loading = false;

      this.$nextTick(() => {
        this.$emit('print');
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.pure {
  text-align: center;

  .card {
    width: 320px;
    height: 440px;
    background: #ffffff;
    border-radius: 15px;
    border: 1px solid #000000;
    margin-right: auto;
    margin-left: auto;
    margin-top: 40px;
    padding: 20px;
    box-sizing: border-box;
  }
  .title {
    font-size: 36px;
    font-weight: 400;
    margin-bottom: 5px;
  }
  .qr-code {
    width: 280px;
    height: 284px;
    border: 1px solid #000000;
    border-radius: 10px;
    margin-right: auto;
    margin-left: auto;
    padding: 40px 40px 0 40px;
    box-sizing: border-box;
    img {
      width: 200px;
      height: 200px;
    }
  }
  .dept {
    font-size: 24px;
    margin-bottom: 26px;
  }
  .dept2 {
    font-size: 24px;
  }
}

</style>
